 <script type="text/javascript"  defer="defer"> 
    function nm_createImage(src,alt,title) { 
        var newImg = new Image();  
        //newImg.onload = function ()  {this.style.visibility='visible';FunOnload}; 
        newImg.src=src;newImg.alt=alt,newImg.title=title;newImg;
        return newImg;  
    }
    function nm_createLink(href,txt,target) { 
        var alink =  document.createElement('a');
        alink.href = href; // For browsers that don't support setAttribute
        alink.setAttribute('href', href);
        alink.setAttribute('target',target)
        alink.title=txt;
        alink.appendChild(document.createTextNode(txt));
        return alink;
    }    
   function nm_removeById(id) {var el = document.getElementById(id);if (el) {el.parentNode.removeChild(el)}}  
   function nm_getChildrenByClass(elem,classStr)  {
      var rt =[];   
      var cnt = -1; 
      for (var i = 0; i < elem.childNodes.length; i++) { 
          if (elem.childNodes[i].className == classStr) {
               cnt++; rt[cnt]=elem.childNodes[i] 
       }
     }  
      return rt
     }   
     
   function nm_fade(elem,steps,delay,out) { 
    //steps 1000 , delay 100 , out 0 or 1 for fadeout   
      for(var i = 0; i < steps; i++) {  
                 setTimeout(function() {
                 elem.style.opacity = Math.abs(out - i/steps); 
            }, delay);   
      }   
    }   
   function initAll(){  
       function createDisclaimer() { 
        var PanLogoImg = nm_createImage ('http://www.panoramio.com//img/header-logo.v1.png','Panoramio Logo','')  
        var PanDiscl = document.createElement('p'); 
        PanDiscl.className="pnrm_disclaimerp"; 
        PanDiscl.appendChild(PanLogoImg)
        PanDiscl.appendChild(document.createTextNode("Photos provided by "));
        PanDiscl.appendChild(PanLogoImg)
        PanDiscl.appendChild(document.createTextNode(" are under the copyright of their owners"));
        pnrm_Cont_DS.appendChild(PanDiscl); 
       } 
     pnrm_Cont_SP = document.getElementById(pnrm_info.containers[0]);
     pnrm_Cont_BP = document.getElementById(pnrm_info.containers[1]);
     pnrm_Cont_DS = document.getElementById(pnrm_info.containers[2]);
     createDisclaimer(); 
     GL_geocoder = new google.maps.Geocoder();
   }

     
  function jsonInit(url,expiresInMs)
     { 
         if (!timeToLiveMS)  var timeToLiveMS = 3000 ; 
         var jsonpScript =  document.createElement("script"); 
        jsonpScript.type="text/javascript";
        url += (url.indexOf("?") == -1 ? "?" : "&amp;amp;amp;") + (new Date().getTime());  // append time so it will not be cashed
         jsonpScript.src=url  
         document.getElementsByTagName("head")[0].appendChild(jsonpScript); 
         setTimeout(function() {
            document.getElementsByTagName("head")[0].removeChild(jsonpScript);
        }, timeToLiveMS);    
     } 
  
  function panoramioGet (arg) {
      var udfd ='undefined' 
      var order=    (typeof(arg.order) == udfd) ?  'popularity'  : arg.order;
      var set=      (typeof(arg.set) == udfd) ?  'public'  : arg.set;
      var startNum= (typeof(arg.startNum) == udfd) ?  0  : arg.startNum;
      var endNum=   (typeof(arg.endNum) == udfd) ?  startNum + pnrm_info.NumOfSP: arg.endNum;
      var minX=     (typeof(arg.minX) == udfd) ?  -180  : arg.minX;
      var minY=     (typeof(arg.minY) == udfd) ?  -90   : arg.minY;
      var maxX=     (typeof(arg.maxX) == udfd) ?  180  :  arg.maxX;
      var maxY=     (typeof(arg.maxY) == udfd) ?  90   :  arg.maxY; 
      var size=     (typeof(arg.size) == udfd) ?  'square'  : arg.size; 
      var call=     (typeof(arg.size) == udfd) ?  'panoramioresults'  : arg.call; 
     jsonStr =  "http://www.panoramio.com/map/get_panoramas.php?order=" +order + "&set="+set +"&from=" + startNum + "&to=" + endNum + "&minx=" + minX + "&miny=" + minY+"&maxx=" + maxX + "&maxy=" + maxY  + "&size="+size +"&callback="+ call    
     //document.getElementById("sidebar").innerHTML= "<p>" + jsonStr  +"<//p>" 
    jsonInit (jsonStr ,3000);     
      if (endNum < 25) { 
            setTimeout(function() {
            panoramioGet ({startNum:endNum+1,endNum:endNum+pnrm_info.NumOfSP+1,minX:minX,minY:minY,maxX:maxX,maxY:maxY})  ;
            }, 10000);       
      }
       
  } 
  
  function panoramioresults(data)
  {  
   photos=data.photos;
   pnrm_info .PhotoNum[0] =       (pnrm_info.PhotoNum[0] == -1) ?  data.count : pnrm_info .PhotoNum[0];  
   var photoBuffer = new Array(); 
   var imgsloadedcnt=0
   var imgsloadedAll= false   
   for(var i = 0; i < photos.length; i++) {   
          var curImg = nm_createImage(photos[i].photo_file_url,photos[i].photo_title,photos[i].photo_title,function () {}) //photoBufferImgLoaded(this));
          curImg.style.color= 'transparent';   // ! masks printing Alt Text before Image is drawn in some browsers    
          curImg.onclick = function () {panImgOnClick(this) };  
          curImg.nm_info=photos[i]
          curImg.imgbig = 0
          curImg.onload =  function ()     {photoBufferImgLoaded(this)} ;
          curImg.onmouseover = function () {panImageBigLoad (this)};
          //curImg.onmouseover = function () {nm_fade(this,100,200,1);nm_fade(this,100,200,0) };     
          photoBuffer[i]= curImg;
          //alert(['====  ',i,photos.length,photoBuffer.length])
   }
   
   function photoBufferImgLoaded(img){
       if (imgsloadedAll) {return true}
       imgsloadedcnt++ 
       //alert(img.complete)
       // document.getElementById("sidebar").innerHTML= "<p>" + imgsloadedcnt +'ff' +  photos.length +"<//p>" 
       if (imgsloadedcnt = photos.length) {
          imgsloadedAll=true  
          pnrm_Cont_SP.innerHTML= ""
           for(var pi = 0; pi < photos.length; pi++) {    
               pnrm_Cont_SP.appendChild(photoBuffer[pi]);
           }  
       }    
    } 
   
   if (nm_getChildrenByClass(pnrm_Cont_BP,'pnrm_imgbig').length < 1)  {panImgOnClick(photoBuffer[0])}
   function panImageBigLoad(imageSmall) {
      if (imageSmall) {
       if (imageSmall.imgbig == 0)  {   
          imageSmall.imgbig = nm_createImage(imageSmall.src.replace('square','medium'),imageSmall.alt,imageSmall.title ) 
          //imageSmall.imgbig.style.width= '100%'; //imageSmall.imgbig.style.color= 'transparent';  
        }  
    } 
    }    
    function panImgOnClick(imgclicked) { 
    if (! imgclicked) {return false};
    panImageBigLoad(imgclicked);
    
    if (imgclicked.imgbig.complete) {displImgBig()} else {imgclicked.imgbig.onload = function () {displImgBig()}};    
    function displImgBig() {
        var prev_big = nm_getChildrenByClass(pnrm_Cont_BP,'pnrm_imgbig')
        if (prev_big.length > 0) {pnrm_Cont_BP.removeChild(prev_big[0])}
        imgclicked.imgbig.className = 'pnrm_imgbig'  
        pnrm_Cont_BP.insertBefore(imgclicked.imgbig,pnrm_Cont_BP.firstChild);
        } ;    
    href=imgclicked.nm_info.owner_url
    var pnrm_userlink  = nm_createLink(href,"user:" + imgclicked.nm_info.owner_name,'_blank');pnrm_userlink.setAttribute("id","pnrm_userlink");
    var pnrm_photolink = nm_createLink(imgclicked.nm_info.photo_url,imgclicked.nm_info.photo_title+' ...','_blank');pnrm_photolink.setAttribute("id","pnrm_photolink"); 
    //alert (document.getElementById('pnrm_photolink'));
    nm_removeById ('pnrm_userlink');
    nm_removeById ('pnrm_photolink'); 
    pnrm_Cont_DS.insertBefore(pnrm_userlink,  pnrm_Cont_DS.firstChild);
    pnrm_Cont_DS.insertBefore(pnrm_photolink, pnrm_Cont_DS.firstChild);  
    photoCoord= new google.maps.LatLng (imgclicked.nm_info.latitude, imgclicked.nm_info.longitude )
   
    if (GL_gmp_map01 && GL_gmp_map01.Loaded) {
        GL_gmp_map01.marker.set_position(photoCoord); 
        geo_RevCode(photoCoord,imgclicked)
        mapMarkerAutoshow (GL_gmp_map01.marker,GL_gmp_map01,photoCoord,5000); 
        ///gmapDiv=document.getElementById('gmap_01') ;gmapDiv.appendChild(pnrm_Cont_BP)
//        if (! GL_gmp_map01.infowin.isInitialized) {
//            google.maps.event.addListener(GL_gmp_map01.infowin , 'closeclick', function() {onInfoWinClose(false)});
//            pnrm_Cont_BP.parentNode.removeChild(pnrm_Cont_BP); 
//            GL_gmp_map01.infowin.isInitialized=true;
//            }
////        if  (GL_gmp_map01.infowin.isOpen) {
////             GL_gmp_map01.infowin.close(); 
////             onInfoWinClose(false); 
////            } 
//        GL_gmp_map01.infowin.set_position(photoCoord);  
//        //if (pnrm_Cont_BP.parentNode) {pnrm_Cont_BP.parentNode.removeChild(pnrm_Cont_BP) }  //this  should be done before load 
//        GL_gmp_map01.centerOld =GL_gmp_map01.get_center()  
//        GL_gmp_map01.infowin.set_content(pnrm_Cont_BP) 
//        GL_gmp_map01.infowin.isOpen=true
//        GL_gmp_map01.infowin.open(GL_gmp_map01);  
//        var TMOclose=setTimeout(function() {if (GL_gmp_map01.infowin.isOpen) {GL_gmp_map01.infowin.close(); onInfoWinClose(true)} }, 20000); 
//        function onInfoWinClose (bytimeout) {
//            if (! bytimeout) {clearTimeout(TMOclose)};
//            GL_gmp_map01.infowin.isOpen=false;
//            GL_gmp_map01.set_center(GL_gmp_map01.centerOld);
//        }  
    }
          
  } 
      
 }  
// Google Maps V3 /////////////////////////////////////////
  function geo_RevCodeToStr(results) { 
    var Country=''
    var rtstr =''
    var tp 
    var frmt  
    var admpat=new RegExp(".*area_level_.*");  
     
    for(var i = 0; i < results.length; i++) { 
        tp = results[i].types    
        frmt = results[i].formatted_address   
         if (tp[1] == 'political') {
           if (tp[0] == 'country') {Country=frmt};
           if ( (tp[0].match(admpat)) || (tp[0]='locality')) {
                    rtstr += frmt.split(',')[0] + ', ' 
                    }  
          }   
        }     
     //alert('res:' + Country + '\n' + rtstr)    
     return [Country,rtstr]  
    }  
  function geo_RevCode(latlng,img) {
   if (img.Country) {return true}     
   if (GL_geocoder) {  
      GL_geocoder.geocode({'latLng': latlng,language:'en',country:'ua'}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          if (results[0]) {
            rt = geo_RevCodeToStr(results); 
            title =img.title
            img.title =  title + ':\n' +rt[1] 
            img.geocode=results
            img.Country=rt[0]
            GL_gmp_map01.marker.set_title(rt[1]);
          } else {
              alert("No results found");
          }
        } else {
          alert("Geocoder failed due to: " + status);
        }
      });
    }
  }
         
 function initGmapCntr (container) {
    //var latlng = new google.maps.LatLng(gmaps_info.rectCntr[0], gmaps_info.rectCntr[1]);
    //container.style.display='inline' 
     
    container.style.visibility='hidden' 
    
    var sw= new google.maps.LatLng(gmaps_info.rectCntr[3], gmaps_info.rectCntr[0]);
    var ne= new google.maps.LatLng(gmaps_info.rectCntr[1], gmaps_info.rectCntr[2]);
    var Bounds= new  google.maps.LatLngBounds(sw,ne);
    var BoundsCenter = Bounds.getCenter(); 
    //BoundsCenter=new google.maps.LatLng(39.0,22.0)
    //alert(Bounds.toString()) 
         
    var myOptions = {
      zoom: 6,
      backgroundColor:'#f3e7d7',
      //disableDefaultUI:true, 
      //center: BoundsCenter,
       
      //#mapTypeControl: true,
      //#mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      //#navigationControl: true,
      //#navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},  
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
     var map = new google.maps.Map(container, myOptions); 
     map.Loaded=false;
     var marker = new google.maps.Marker({
        position: BoundsCenter, 
        flat:true, 
        map: map,
        title:"+"
    }); 
    map.marker=marker  
    marker.set_visible(false);  
    infoWin= new google.maps.In
      //try {map.fitBounds(Bounds);} 
      //catch(err) {alert(err) }  // !tempo  
      google.maps.event.addListener(map, 'tilesloaded', function() { 
          
          if (! map.Loaded) {
              container.style.visibility='visible';
              mapMarkerAutoshow (marker,map,BoundsCenter,3000);  
              mapControlsVisibility (map,false);
              mapControlsClassName (map,'nm_gmap_cntrl');
          }
          map.Loaded=true;
        });
      google.maps.event.addListener(map, 'dblclick', function(event)  { 
          map.fitBounds(Bounds)    
          document.getElementById("sidebar").innerHTML= "<p>" + 'lat-lng' +event.latLng.toString() +"<//p>";
          window.status('lat-lng' + event.latLng.toString());
      });
      //map.resize
      //alert(Bounds) 
      //setTimeout(function() {map.fitBounds(Bounds);}, 75); // give it some time coz some bug with fitbounds if centered not initialized especially with huge areas like Russia, Canada
      map.fitBounds(Bounds) 
      
      container.onmouseover = function () {mapControlsVisibility (map,true) }; 
      container.onmouseout  = function () {mapControlsVisibility (map,false) }; 
      return map     
  }  
  function mapMarkerAutoshow (gmarker,gmap,latlng,showtime) {
    gmarker.set_map(gmap);  
    gmarker.set_position(latlng); 
    gmarker.set_visible(true);
    if  (showtime) { setTimeout(function() {gmarker.set_visible(false) }, showtime); }  
    }
  function mapControlsVisibility (gmap,visible) {
    var visibility =      (visible) ?  'visible'  : 'hidden'   
    var housediv=gmap.getDiv();
    housediv.childNodes[3].style.visibility = visibility;
    housediv.childNodes[4].style.visibility = visibility;   
  }
  function mapControlsClassName (gmap,className) { 
    var housediv=gmap.getDiv();
    housediv.childNodes[3].className = className 
    housediv.childNodes[4].className = className    
  }
///////////////////////////////////////////////////////// 
  function afterLoad () 
   {  
    //document.body.style.cursor = "wait"   
     initAll();  
     setTimeout(function() { GL_gmp_map01 = initGmapCntr(document.getElementById(gmaps_info.containers[0])); }, 100);   
     //initGmapCntr(document.getElementById(gmaps_info.containers[0]));
     //GL_gmp_map01 = initGmapCntr(document.getElementById(gmaps_info.containers[0]));
     setTimeout(function() {  panoramioGet ({minX:pnrm_info .rect[0],minY:pnrm_info .rect[3],maxX:pnrm_info .rect[2],maxY:pnrm_info .rect[1]}); }, 100); 
     //panoramioGet ({minX:pnrm_info .rect[0],minY:pnrm_info .rect[3],maxX:pnrm_info .rect[2],maxY:pnrm_info .rect[1]});  
     // setTimeout(function() {gmp_map01.marker.set_visible(true) }, 7000);  
    //document.body.style.cursor = "default";
   }   
   
 
 window.onload =  afterLoad; 
 </script>
   
////// get CSS style of element 

function getStyle(oElm, strCssRule){
        var strValue = "";
        if(document.defaultView && document.defaultView.getComputedStyle){
            strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
        }
        else if(oElm.currentStyle){
            strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
                return p1.toUpperCase();
            });
            strValue = oElm.currentStyle[strCssRule];
        }
        return strValue;
    }       
   
   
/////////////////////////   not working for ie  since it uses shapes 
   
   function nm_setChartBC() {
      //does not work in ie but some flickering due to repaint - should be called before onload ? 
      var ifrs=document.getElementsByTagName("iframe"); 
      function iframeContent(ifr) {
          if(ifr.contentDocument)  
          // Firefox, Opera  
             return ifr.contentDocument;  
          else {return ifr.contentWindow}  
      }
      for(var i=0;i<ifrs.length;i++){
            //var ifrParent=ifrs[i].parentNode;    
            var BGNColor=getStyle(ifrs[i],'background-color'); 
            var FRNColor=getStyle(ifrs[i],'color');
            // var el =  ifrs[i].contentDocument.getElementsByTagName('rect')[0] 
            var el = iframeContent(ifrs[i])
            if (el) {el.setAttribute('fill',BGNColor)};
            // el = ifrs[i].contentDocument.getElementsByTagName('text')
            el = el.getElementsByTagName('text')
            for(var j=0;j<el.length;j++){
                el[j].setAttribute('fill',FRNColor);              
            }  
            //ifrParent.style.visibility='visible'
          }  
    }
